package main

import (
	"flag"
	"fmt"

	"algo-sdk-go/project/matchmaking/matchMaking-api/config"
	"algo-sdk-go/project/matchmaking/matchMaking-api/di"
	"algo-sdk-go/project/matchmaking/matchMaking-api/internal/handler"

	"github.com/zeromicro/go-zero/rest"
)

func main() {
	flag.Parse()

	ctx := di.BuildSvc()
	c := ctx.Config

	server := rest.MustNewServer(c.RestConf)
	defer server.Stop()

	handler.RegisterHandlers(server, ctx)

	config.DynamicCatchApolloChanges(ctx.Config)
	fmt.Printf("Starting server at %s:%d...\n", c.RestConf.Host, c.RestConf.Port)
	server.Start()
}
